package com.UnionPayCenter.service;

import com.UnionPayCenter.account.entity.FundsBill;
import com.UnionPayCenter.domain.UserQuery;
import com.UnionPayCenter.entity.UserEntity;
import com.UnionPayCenter.entity.vo.FundsBillRecordVo;
import com.UnionPayCenter.entity.vo.UserVo;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;
import java.util.Map;

public interface IUserService {

    /**
     * @Description: 会员注册获取验证码
     * @Param:
     * @return:
     * @Author: bite
     * @Date: 2019/4/25
     */
    boolean getVerificationCode(JSONObject jsonParam);

    /**
     * @Description: 会员注册
     * @Param:
     * @return:
     * @Author: bite
     * @Date: 2019/4/25
     */
    UserVo registry(JSONObject jsonParam);

    /**
     * @Description: 根据对应商铺与会员openid获取会员信息
     * @Param:
     * @return:
     * @Author: bite
     * @Date: 2019/4/25
     */
    UserEntity getUser(JSONObject jsonParam);

    /**
     * @Description: 查询会员列表
     * @Param:
     * @return:
     * @Author: bite
     * @Date: 2019/4/25
     */
    PageInfo<UserVo> findList(JSONObject jsonParam);

    /**
     * 根据条件查询所有用户信息
     * @param userQuery 查询信息
     * @param shopId  店铺id
     * @return
     */
    List<UserVo> findList(UserQuery userQuery,Integer shopId);

    /**
     * @Description: 查询会员信息
     * @Param:
     * @return:
     * @Author: bite
     * @Date: 2019/4/25
     */
    UserEntity findUser(JSONObject jsonParam);

    /**
     * @Description: 修改会员信息
     * @Param:
     * @return:
     * @Author: bite
     * @Date: 2019/4/25
     */
    boolean updateUser(JSONObject jsonParam);

    /**
     * @Description: 会员导入模版下载
     * @Param:
     * @return:
     * @Author: bite
     * @Date: 2019/4/28
     */
    String exportModel(JSONObject jsonParam) throws IOException;

    /**
     * @Description: 会员导入
     * @Param:
     * @return:
     * @Author: bite
     * @Date: 2019/4/29
     */
    List<UserVo> importUser(Integer managerId, Integer shopId, MultipartFile file) throws IOException;

    /**
     * @param jsonParam
     * @return
     * @throws Exception
     * @Description: 请求微信接口获取openId
     */
    UserVo getOpenId(JSONObject jsonParam) throws Exception;

    /**
     * @param jsonParam
     * @return
     * @throws Exception
     * @Description: 微信小程序领取卡券生成签名
     */
    Map<String, Object> getSignature(JSONObject jsonParam) throws Exception;

    /**
     * @Description: 微信小程序手机号授权注册登录
     * @Param:
     * @return:
     * @Author: bite
     * @Date: 2019/5/15
     */
    UserVo getByMobile(JSONObject jsonParam);

    /**
     * @Description: 根据会员id获取会员信息
     * @Param:
     * @return:
     * @Author: bite
     * @Date: 2019/5/28
     */
    UserVo getUserInfo(Integer userId);

    /**
     * @Description: 验证短信验证码 成功返回true，否则返回false
     * @Param: mobile：手机号，code：验证码， type：0-注册 1-支付
     * @return:
     * @Author: bite
     * @Date: 2019/5/29
     */
    boolean checkVerificationCode(String mobile, String code, Integer type);

    /**
     * @Description: 微信支付获取会员信息
     * @Param:
     * @return:
     * @Author: bite
     * @Date: 2019/6/1
     */
    UserEntity wechatPayGetUser(Integer userId);

    /**
     * @Description: 根据手机号与shopid查询会员
     * @Param:
     * @return:
     * @Author: bite
     * @Date: 2019/6/9
     */
    UserEntity getUserByMobile(String mobile, Integer shopId);

    /**
     * @Description: 根据会员id查询会员
     * @Param:
     * @return:
     * @Author: bite
     * @Date: 2019/6/9
     */
    UserEntity getUserById(Integer userId);

    /**
     * 批量查询会员id
     *
     * @param userIds
     * @return
     */
    List<UserEntity> getUserById(List<Integer> userIds);


    /**
     * 根据店铺id, 查询会员信息
     *
     * @param shopId 店铺Id
     * @return 会员信息
     */
    List<UserEntity> getUserByShopId(Integer shopId);

    /**
     * @param fundsList
     * @return
     * @throws IOException
     * @Description: 会员资金导出
     */
    String exportUserFunds(List<FundsBill> fundsList) throws IOException;

    String exportThirdFunds(List<FundsBillRecordVo> fundsList) throws IOException;

    /**
     * @param jsonParam
     * @return
     * @Description: 保存会员卡号
     */
    UserEntity saveCardNum(JSONObject jsonParam);

    /**
     * @Description: 根据openid获取会员信息
     * @Param:
     * @return:
     * @Author: bite
     * @Date: 2019/6/15
     */
    UserVo getByWxCard(String wxCard);

    /**
     * @Description: 保存openid
     * @Param:
     * @return:
     * @Author: bite
     * @Date: 2019/6/20
     */
    boolean saveOpenid(JSONObject jsonParam);

    /**
     * @Description: 支付后获取unionid
     * @Param:
     * @return:
     * @Author: bite
     * @Date: 2019/6/17
     */
    boolean getPaidUnionId(Integer userId, String paymentProviderTrxId) throws Exception;

    /**
     * @Description: 根据商铺id和unionid查询会员
     * @Param:
     * @return:
     * @Author: bite
     * @Date: 2019/6/20
     */
    UserVo getByUnionid(String unionId, Integer shopId);

    /**
     * @Description: 保存formid
     * @Param:
     * @return:
     * @Author: bite
     * @Date: 2019/6/20
     */
    boolean saveFormid(JSONObject jsonParam);

    /**
     * @Description: 获取小程序码
     * @Param:
     * @return:
     * @Author: bite
     * @Date: 2019/7/14
     */
    String getUnlimited(JSONObject jsonParam);

    /**
     * @Description: 修改用户基本信息
     * @Param:
     * @return:
     * @Author: bite
     * @Date: 2019/7/20
     */
    boolean updateBaseInfo(String plainText);

    /**
     * 更新用户会员等级
     *
     * @param userId  用户ID
     * @param levelId 会员等级
     */
    void updateUserLevel(Integer userId, Integer levelId);
}
